//
// Created by Aron on 2024/11/2.
//

#include "cup_motor.h"
#include "remote_control.h"
#include "tim.h"
static float set_angle=1500;
static float delta_CM=10.0f;
void cup_motor_control(void){
    if (rc_ctrl.rc.s[0]==3) {
        if (rc_ctrl.rc.s[1] == 1) {
            set_angle+=delta_CM;
            if (set_angle>2495) {
                set_angle = 2500;
            }
        } else if (rc_ctrl.rc.s[1] == 2) {
            set_angle-=delta_CM;
            if (set_angle<505) {
                set_angle = 500;
            }
        }
        __HAL_TIM_SetCompare(&htim1, TIM_CHANNEL_1, set_angle);
    }
}